<?php
class searchdao extends daobase {
 	public function blogSearch($key){
 		$sql = "select * from blog where ";
 		if (is_array($key)){
 			foreach ($key as $key=>$singeKey){
 				if ($key==0):
 					$sql.="(title like '%$singeKey%' or content like '%$singeKey%')";
 				else:
 					$sql.=" and (title like '%$singeKey%' or content like '%$singeKey%')";
 				endif;
 			}
 		}else {
 			$sql = "select * from blog where title like '%$key%' or content like '%$key%'";
 		}
		$sql.=" order by id desc";
 		$search = $this->fetchit($sql);
 		return $search;
 	}
 	public function getBlogDetail($blogId){
 		$sql = "select content from blog where id='$blogId'";
 		return $this->fetchit($sql);
 	}
}